package teacher.action;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;

import teacher.bean.Award;
import teacher.bean.Paper;
import teacher.bean.Patent;
import teacher.bean.Project;
import teacher.bean.Teacher;
import teacher.bean.Treatise;
import teacher.service.paper;
import teacher.service.treatise;
import teacher.service.project;
import teacher.service.award;
import teacher.service.patent;
import teacher.service.laohe.Static;


import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class coutnTea extends ActionSupport{
	private Integer countAwa0;
	private Integer countAwa1;
	private Integer countAwa2;
	private Integer countAwa3;
	
	private Integer countPap0;
	private Integer countPap1;
	private Integer countPap2;
	private Integer countPap3;
	private Integer countPap4;
	private Integer countPap5;
	public Integer getCountPap3() {
		return countPap3;
	}

	public void setCountPap3(Integer countPap3) {
		this.countPap3 = countPap3;
	}

	public Integer getCountPap4() {
		return countPap4;
	}

	public void setCountPap4(Integer countPap4) {
		this.countPap4 = countPap4;
	}

	public Integer getCountPap5() {
		return countPap5;
	}

	public void setCountPap5(Integer countPap5) {
		this.countPap5 = countPap5;
	}

	public Integer getCountPap6() {
		return countPap6;
	}

	public void setCountPap6(Integer countPap6) {
		this.countPap6 = countPap6;
	}

	private Integer countPap6;
	
	private Integer countPat0;
	private Integer countPat1;
	private Integer countPat2;
	
	private Integer countPro0;
	private Integer countPro1;
	private Integer countPro2;
	private Integer countPro3;
	private Integer countPro4;
	private Integer countPro5;
	private Integer countPro6;
	private Integer countPro7;
	private Integer countPro8;
	private Integer countPro9;
	
	private Integer countTre0;
	private Integer countTre1;
	private Integer countTre2;
	private Integer countTre3;
	public Integer getCountPro7() {
		return countPro7;
	}

	public void setCountPro7(Integer countPro7) {
		this.countPro7 = countPro7;
	}

	public Integer getCountPro8() {
		return countPro8;
	}

	public void setCountPro8(Integer countPro8) {
		this.countPro8 = countPro8;
	}

	public Integer getCountPro9() {
		return countPro9;
	}

	public void setCountPro9(Integer countPro9) {
		this.countPro9 = countPro9;
	}

	
	public Integer getCountPro4() {
		return countPro4;
	}

	public void setCountPro4(Integer countPro4) {
		this.countPro4 = countPro4;
	}

	public Integer getCountPro5() {
		return countPro5;
	}

	public void setCountPro5(Integer countPro5) {
		this.countPro5 = countPro5;
	}

	public Integer getCountPro6() {
		return countPro6;
	}

	public void setCountPro6(Integer countPro6) {
		this.countPro6 = countPro6;
	}

	
	
	public Integer getCountPap0() {
		return countPap0;
	}

	public void setCountPap0(Integer countPap0) {
		this.countPap0 = countPap0;
	}

	public Integer getCountPap1() {
		return countPap1;
	}

	public void setCountPap1(Integer countPap1) {
		this.countPap1 = countPap1;
	}

	public Integer getCountPap2() {
		return countPap2;
	}

	public void setCountPap2(Integer countPap2) {
		this.countPap2 = countPap2;
	}

	public Integer getCountAwa0(){
		return countAwa0;
	}

	public void setCountAwa0(Integer countAwa0) {
		this.countAwa0 = countAwa0;
	}

	public Integer getCountAwa2() {
		return countAwa2;
	}

	public void setCountAwa2(Integer countAwa2) {
		this.countAwa2 = countAwa2;
	}

	public Integer getCountAwa3() {
		return countAwa3;
	}

	public void setCountAwa3(Integer countAwa3) {
		this.countAwa3 = countAwa3;
	}

	
	public Integer getCountPat0() {
		return countPat0;
	}

	public void setCountPat0(Integer countPat0) {
		this.countPat0 = countPat0;
	}

	public Integer getCountPat1() {
		return countPat1;
	}

	public void setCountPat1(Integer countPat1) {
		this.countPat1 = countPat1;
	}

	public Integer getCountPat2() {
		return countPat2;
	}

	public void setCountPat2(Integer countPat2) {
		this.countPat2 = countPat2;
	}


	public Integer getCountPro0() {
		return countPro0;
	}

	public void setCountPro0(Integer countPro0) {
		this.countPro0 = countPro0;
	}

	public Integer getCountPro1() {
		return countPro1;
	}

	public void setCountPro1(Integer countPro1) {
		this.countPro1 = countPro1;
	}

	public Integer getCountPro2() {
		return countPro2;
	}

	public void setCountPro2(Integer countPro2) {
		this.countPro2 = countPro2;
	}

	public Integer getCountPro3() {
		return countPro3;
	}

	public void setCountPro3(Integer countPro3) {
		this.countPro3 = countPro3;
	}



//	private Integer countDeg;

	public Integer getCountTre0() {
		return countTre0;
	}

	public void setCountTre0(Integer countTre0) {
		this.countTre0 = countTre0;
	}

	public Integer getCountTre1() {
		return countTre1;
	}

	public void setCountTre1(Integer countTre1) {
		this.countTre1 = countTre1;
	}

	public Integer getCountTre2() {
		return countTre2;
	}

	public void setCountTre2(Integer countTre2) {
		this.countTre2 = countTre2;
	}

	public Integer getCountTre3() {
		return countTre3;
	}

	public void setCountTre3(Integer countTre3) {
		this.countTre3 = countTre3;
	}


	public Integer getCountAwa1() {
		return countAwa1;
	}

	public void setCountAwa1(Integer countAwa) {
		this.countAwa1 = countAwa;
	}

	/*public Integer getCountDeg() {
		return countDeg;
	}

	public void setCountDeg(Integer countDeg) {
		this.countDeg = countDeg;
	}
*/
	public String execute()
	{
		HttpServletRequest request=ServletActionContext.getRequest();
		Teacher tea=(Teacher)request.getSession().getAttribute("teacher");
		tea.setUser(tea.getUser());
		//论文开始
		Map map2=new HashMap();
		Map map3=new HashMap();
		
		for(int i=0;i<4;i++)
		{
			Paper paper0=new Paper();
			paper0.setType(0);
			paper0.setJclass(i);
			map2.put(i, new Static().getPaperCountByUser(paper0, null, tea));
		}
		countPap0=Integer.parseInt(map2.get(0).toString());
		countPap1=Integer.parseInt(map2.get(1).toString());
		countPap2=Integer.parseInt(map2.get(2).toString());
		countPap3=Integer.parseInt(map2.get(3).toString());
		for(int i=0;i<3;i++)
		{
			Paper paper0=new Paper();
			paper0.setType(1);
			paper0.setMeetClass(i);
			map3.put(i, new Static().getPaperCountByUser(paper0, null, tea));
		}
		countPap4=Integer.parseInt(map3.get(0).toString());
		countPap5=Integer.parseInt(map3.get(1).toString());
		countPap6=Integer.parseInt(map3.get(2).toString());
		
		//论文结束
		//专利开始
		Patent patent0=new Patent();
		Patent patent1=new Patent();
		Patent patent2=new Patent();
		patent0.setExpClass(0);
		patent1.setExpClass(1);
		patent2.setExpClass(2);
		countPat0=new Static().getPatentCountByUser(patent0, null, null, tea);
		countPat1=new Static().getPatentCountByUser(patent1, null, null, tea);
		countPat2=new Static().getPatentCountByUser(patent2, null, null, tea);
		//专利结束
		//工程开始
		Map map=new HashMap();
		Map map1=new HashMap();
		for(int i=0;i<7;i++)
		{
			Project project=new Project();
			project.setKind(0);
			project.setClass_(i);
			int a=new Static().getProjectCountByUser(project, tea);
			map.put(i,a);
			
		}
		for(int i=0;i<3;i++)
		{
			Project project=new Project();
			project.setKind(1);
			project.setClass_(i);
			int a=new Static().getProjectCountByUser(project, tea);
			map1.put(i,a);
			
		}
		
		countPro0=Integer.parseInt(map.get(0).toString());
		countPro1=Integer.parseInt(map.get(1).toString());
		countPro2=Integer.parseInt(map.get(2).toString());
		countPro3=Integer.parseInt(map.get(3).toString());
		countPro4=Integer.parseInt(map.get(4).toString());
		countPro5=Integer.parseInt(map.get(5).toString());
		countPro6=Integer.parseInt(map.get(6).toString());
		countPro7=Integer.parseInt(map1.get(0).toString());
		countPro8=Integer.parseInt(map1.get(1).toString());
		countPro9=Integer.parseInt(map1.get(2).toString());
		//Integer.parseInt(map.get(0).toString());
	/*	Project project0 =new Project();
		Project project1 =new Project();
		Project project2 =new Project();
		Project project3 =new Project();		
		Project project4 =new Project();		
		Project project5 =new Project();		
		Project project6 =new Project();		
		project0.setClass_(0);
		project1.setClass_(1);
		project2.setClass_(2);
		project3.setClass_(3);		
		project3.setClass_(4);		
		project3.setClass_(5);		
		project3.setClass_(6);		
		countPro0=new Static().getProjectCountByUser(project0, tea);
		countPro1=new Static().getProjectCountByUser(project1, tea);
		countPro2=new Static().getProjectCountByUser(project2, tea);
		countPro3=new Static().getProjectCountByUser(project3, tea);
		countPro4=new Static().getProjectCountByUser(project4, tea);
		countPro5=new Static().getProjectCountByUser(project5, tea);
		countPro6=new Static().getProjectCountByUser(project6, tea);
		*/
		//工程结束
		//论著开始
		Treatise treatise0=new Treatise();
		Treatise treatise1=new Treatise();
		Treatise treatise2=new Treatise();
		Treatise treatise3=new Treatise();
		treatise0.setClass_(0);
		treatise1.setClass_(1);
		treatise2.setClass_(2);
		treatise3.setClass_(3);
		countTre0=new Static().getTreatiseCountByUser(treatise0, null, tea);
		countTre1=new Static().getTreatiseCountByUser(treatise1, null, tea);
		countTre2=new Static().getTreatiseCountByUser(treatise2, null, tea);
		countTre3=new Static().getTreatiseCountByUser(treatise3, null, tea);

		//论著结束
		//获奖开始
		Award award0=new Award();
		Award award1=new Award();
		Award award2=new Award();
		Award award3=new Award();
		award0.setLevel(0);
		award1.setLevel(1);
		award2.setLevel(2);
		award3.setLevel(3);		
		 countAwa0=new Static().getAwardCountByUser(award0, null, tea);
		 countAwa1=new Static().getAwardCountByUser(award1, null, tea);
		 countAwa2=new Static().getAwardCountByUser(award2, null, tea);
		 countAwa3=new Static().getAwardCountByUser(award3, null, tea);
		 //获奖结束
	//	countDeg=new degreePaper().getCountDegreePaperTea(tea);	
		return SUCCESS;
	}
	/*public static void main(String[] args)
	{  
		Teacher tea=(Teacher)ActionContext.getContext().getSession().get("teacher");
		//HttpServletRequest request=ServletActionContext.getRequest();
		//Teacher tea=(Teacher)request.getSession().getAttribute("teacher");
		int countAwa=new award().getCountAwardTea(tea);
		System.out.println(countAwa);
	}
*/
}
